
#import "FZ_BoFang_Two_TableViewCell_Three.h"
#import "BaseHeader.h"

@interface UIImage(UIImageScale)
- (UIImage*)OriginImage:(UIImage*)image scaleToSize:(CGSize)size;

@end
@interface FZ_BoFang_Two_TableViewCell_Three ()
@property (nonatomic, retain) UIView *viewDown;
@end
@implementation FZ_BoFang_Two_TableViewCell_Three

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
    
        [self createSubView];
    
    }
    return self;
}

- (void)createSubView{

    self.sliderPlayProgress = [[UISlider alloc] init];
//    UIImage *image = [[UIImage alloc] init];
//    [image OriginImage:[UIImage imageNamed:@"2015-11-16 7.25.59.png"] scaleToSize:CGSizeMake(10.f, 10.f)];

    [_sliderPlayProgress setThumbImage:[UIImage imageNamed:@"baidianda16.png"] forState:UIControlStateNormal];

//    _sliderPlayProgress.backgroundColor = [UIColor orangeColor];
    [self.contentView addSubview:self.sliderPlayProgress];
    [_sliderPlayProgress release];
    

    self.labelBeginTime = [[UILabel alloc] init];
    self.labelBeginTime.backgroundColor = [UIColor redColor];
    [self.contentView addSubview:self.labelBeginTime];
    [_labelBeginTime release];
    self.labelEndTime = [[UILabel alloc] init];
    self.labelEndTime.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.labelEndTime];
    [_labelEndTime release];
    self.buttonMode = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonMode setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonMode];
    
    self.buttonBack = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonBack setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonBack];
    
    self.buttonStop = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonStop setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonStop];
    
    self.buttonNext = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonNext setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonNext];
    
    self.buttonShare = [UIButton buttonWithType:UIButtonTypeCustom];
    self.buttonShare.tag = 100001;
    [self.buttonShare setBackgroundColor:[UIColor orangeColor]];

    _labelBeginTime = [[UILabel alloc] init];
    _labelBeginTime.font = [UIFont systemFontOfSize:13];
    [_labelBeginTime setTextColor:[UIColor whiteColor]];

    [self.contentView addSubview:self.labelBeginTime];
    [_labelBeginTime release];
    _labelEndTime = [[UILabel alloc] init];
    _labelEndTime.font = [UIFont systemFontOfSize:13];
    [_labelEndTime setTextColor:[UIColor whiteColor]];
//    _labelEndTime.backgroundColor = [UIColor blueColor];
    [self.contentView addSubview:self.labelEndTime];
    [_labelEndTime release];
    
    self.buttonMode = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonMode setBackgroundImage:[UIImage imageNamed:@"iconfont-yuledanquxunhuan.png"] forState:UIControlStateNormal];

    [self.contentView addSubview:self.buttonMode];
    
    self.buttonBack = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonBack setBackgroundImage:[UIImage imageNamed:@"shangyiqu128.png"] forState:UIControlStateNormal];
//    [_buttonBack setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonBack];
    
    self.buttonStop = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonStop setBackgroundImage:[UIImage imageNamed:@"kaishi32.png"] forState:UIControlStateNormal];
//    [_buttonStop setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonStop];
    
    self.buttonNext = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonNext setBackgroundImage:[UIImage imageNamed:@"xiayiqu128.png"] forState:UIControlStateNormal];
//    [_buttonNext setBackgroundColor:[UIColor orangeColor]];
    [self.contentView addSubview:self.buttonNext];
    
    self.buttonShare = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.buttonShare setBackgroundImage:[UIImage imageNamed:@"yinliangHui32.png"] forState:UIControlStateNormal];
//    [_buttonShare setBackgroundColor:[UIColor orangeColor]];

    [self.contentView addSubview:self.buttonShare];
}

-(void)layoutSubviews{
    [super layoutSubviews];

    

    self.sliderPlayProgress.frame = CGRectMake(70, 75, 235, 10);
    self.labelBeginTime.frame = CGRectMake(self.sliderPlayProgress.frame.origin.x - 25, self.sliderPlayProgress.frame.origin.y + 4  + self.sliderPlayProgress.frame.size.height, 40, 20);
//        _labelBeginTime.backgroundColor = [UIColor redColor];
    self.labelEndTime.frame = CGRectMake(self.sliderPlayProgress.frame.origin.x + self.sliderPlayProgress.frame.size.width - 25, self.labelBeginTime.frame.origin.y, self.labelBeginTime.frame.size.width, self.labelBeginTime.frame.size.height);
//    [_buttonMode setBackgroundColor:[UIColor orangeColor]];
    self.buttonMode.frame = CGRectMake(self.sliderPlayProgress.frame.origin.x - 10, self.sliderPlayProgress.frame.origin.y - 15 + self.labelBeginTime.frame.size.height + self.labelBeginTime.frame.origin.y, 30, 27);
    self.buttonBack.frame = CGRectMake(self.buttonMode.frame.origin.x + 20 + self.buttonMode.frame.size.width, self.buttonMode.frame.origin.y, 30, 30);
    self.buttonStop.frame = CGRectMake(self.buttonBack.frame.origin.x + 20 + self.buttonBack.frame.size.width, self.buttonBack.frame.origin.y - 10, 45, 45);
    self.buttonNext.frame = CGRectMake(self.buttonStop.frame.origin.x + 20+ self.buttonStop.frame.size.width, self.buttonBack.frame.origin.y, 30, 30);

    self.buttonShare.frame = CGRectMake(self.buttonNext.frame.origin.x + 20 + self.buttonNext.frame.size.width, self.buttonNext.frame.origin.y + 3, 25, 25);

    self.buttonShare.frame = CGRectMake(self.buttonNext.frame.origin.x + 20 + self.buttonNext.frame.size.width, self.buttonNext.frame.origin.y, 30, 30);


    
}

//-(UIImage*)OriginImage:(UIImage *)image   scaleToSize:(CGSize)size
//{
//    // 创建一个bitmap的context
//    // 并把它设置成为当前正在使用的context
//    UIGraphicsBeginImageContext(size);
//    
//    // 绘制改变大小的图片
//    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
//    
//    // 从当前context中创建一个改变大小后的图片
//    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
//    
//    // 使当前的context出堆栈
//    UIGraphicsEndImageContext();
//    
//    // 返回新的改变大小后的图片
//    return scaledImage;
//    
//}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
